<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>体检项目</title>
    <link rel="stylesheet" href="../css/proProject.css">
    <script src="../js/jquery.js"></script>
    <script src="../js/phyProject.js"></script>
</head>
<body>
<!--体检项目操作界面-->
<div id="phyProjectOper">
    <button id="phyProjectOperAddBtn">新增项目</button>
    <label for="phyProjectOperSelectInput">项目名称</label>
    <input type="text" id="phyProjectOperSelectInput" placeholder="输入项目名称">
    <button id="phyProjectOperSelectBtn">点击查询</button>
</div>
<hr/>
<!--显示已有项目-->
<div class="phyProjectInformation">
    <table id="tb_phyProject" cellspacing="0" cellpadding="2" width="100%" border="1">
        <tbody>
        <tr align="center" bgcolor="#dcdcdc">
            <td style="width:30px;"><input id="phyProjectInformationFather" type="checkbox"></td>
            <td>序号</td>
            <td>项目名称</td>
            <td>科室</td>
            <td>参考指标</td>
            <td>操作</td>
        </tr>
        <!--<tr>-->
            <!--<td style="width:30px;"><input class="phyProjectInformationSon" type="checkbox"></td>-->
            <!--<td>1</td>-->
            <!--<td>身高</td>-->
            <!--<td>外科</td>-->
            <!--<td>无</td>-->
            <!--<td>-->
                <!--<button class="phyProjectInformationUpdateBtn">编辑</button>-->
                <!--<button class="phyProjectInformationCancelBtn">删除</button>-->
        <!--</tr>-->
        </tbody>
    </table>
</div>
<!--新增项目-->
<div class="addNewProject">
    <div>
        <label for="addNewProjectNameInput">项目名称</label>
        <input type="text" id="addNewProjectNameInput" placeholder="请输入项目名称">
        <span id="judgeName"></span>
    </div>
    <div>
        <label for="addNewProjectNormInput">参考指标</label>
        <input type="text" id="addNewProjectNormInput" placeholder="请输入参考指标">
        <span id="judgeNorm"></span>
    </div>
    <div>
        <label for="addNewProjectOfcInput">所属科室</label>
        <select id="addNewProjectOfcInput">
            <!--<option>请选择科室</option>-->
        </select>
    </div>
    <div id="addNewProjectInputButton">
        <button id="addNewProjectInputSureBtn" type="submit">确认</button>
        <button id="addNewProjectInputBackBtn" type="submit">返回</button>
    </div>
</div>
<!--编辑按钮弹出框获取信息-->
<div class="phyProjectUpdateBtnClickGetInfo">
    <div>
        <label for="getPhyProjectName">项目名称</label>
        <input type="text" class="getPhyProject" id="getPhyProjectName" value="">
    </div>
    <div>
        <label for="getPhyProjectBeginTime">所属科室</label>
        <input type="text" class="getPhyProject" id="getPhyProjectBeginTime" value="" disabled="disabled">
    </div>
    <div>
        <label for="getPhyProjectEndTime">参考指标</label>
        <input type="text" class="getPhyProject" id="getPhyProjectEndTime" value="">
    </div>
    <div>
        <button id="phyProjectUpdateBtnClickGetInfoSureBtn">确认</button>
        <button id="phyProjectUpdateBtnClickGetInfoBackBtn">返回</button>
    </div>
</div>
<div id="over"></div>
<!--表格宽度可伸缩事件-->
<script type="text/javascript">
    var tTD; //用来存储当前更改宽度的Table Cell,避免快速移动鼠标的问题
    var table = document.getElementById("tb_phyProject");
    for (j = 0; j < table.rows[0].cells.length; j++) {
        table.rows[0].cells[j].onmousedown = function () {
//记录单元格
            tTD = this;
            if (event.offsetX > tTD.offsetWidth - 10) {
                tTD.mouseDown = true;
                tTD.oldX = event.x;
                tTD.oldWidth = tTD.offsetWidth;
            }
//记录Table宽度
//table = tTD; while (table.tagName != ‘TABLE') table = table.parentElement;
//tTD.tableWidth = table.offsetWidth;
        };
        table.rows[0].cells[j].onmouseup = function () {
//结束宽度调整
            if (tTD == undefined) tTD = this;
            tTD.mouseDown = false;
            tTD.style.cursor = 'default';
        };
        table.rows[0].cells[j].onmousemove = function () {
//更改鼠标样式
            if (event.offsetX > this.offsetWidth - 10)
                this.style.cursor = 'col-resize';
            else
                this.style.cursor = 'default';
//取出暂存的Table Cell
            if (tTD == undefined) tTD = this;
//调整宽度
            if (tTD.mouseDown != null && tTD.mouseDown == true) {
                tTD.style.cursor = 'default';
                if (tTD.oldWidth + (event.x - tTD.oldX) > 0)
                    tTD.width = tTD.oldWidth + (event.x - tTD.oldX);
//调整列宽
                tTD.style.width = tTD.width;
                tTD.style.cursor = 'col-resize';
//调整该列中的每个Cell
                table = tTD;
                while (table.tagName != 'TABLE') table = table.parentElement;
                for (j = 0; j < table.rows.length; j++) {
                    table.rows[j].cells[tTD.cellIndex].width = tTD.width;
                }
//调整整个表
//table.width = tTD.tableWidth + (tTD.offsetWidth – tTD.oldWidth);
//table.style.width = table.width;
            }
        };
    }
</script>
</body>
</html>